﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EzDesk.Apps.Model.Message;
using EzDesk.EzAppApi.Utility;
using EzDesk.Core.Model;

namespace EzDesk.Clients.MobileWeb.Extensions.Message
{
    public static class ViewModelExtensions
    {
        public static IEzApiClient EzApiClient
        {
            get { return EzAppApi.Utility.EzApiClient.Instance; }
        }

        public static SimpleUser GetSenderInfo(this SingleMessage message)
        {
            return EzApiClient.GetSimpleUserInfos(message.SenderId.ToString()).SingleOrDefault();
        }

        public static bool IsEmpty(this ParticipatorsInfo info)
        {
            return (info.UserParticipators == null || info.UserParticipators.Count == 0)
                && (info.GroupParticipators == null || info.GroupParticipators.Count == 0);
        }

    }
}